<?php
class Fileupload{
	public function upload(){
		$msg='';
		$FileUpload=&WoniuController::getInstance();
		if ($_FILES["files"]["error"] > 0)
  {
	  //错误处理
  }
else
  {
  $msg.="Upload: " . $_FILES["files"]["name"] . "<br />";
  $msg.="Type: " . $_FILES["files"]["type"] . "<br />";
  $msg.="Size: " . ($_FILES["files"]["size"] / 1024) . " Kb<br />";
  if (file_exists("public/upload/" . $_FILES["files"]["name"]))
      {
      $msg.=$_FILES["files"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["files"]["tmp_name"],"public/upload/". mb_convert_encoding($_FILES["files"]["name"],'GB2312','UTF-8'));
      $msg.="文件保存到: " . "public/upload/" . $_FILES["files"]["name"];
      }

  }
	return $msg;
	}
}
?>